package com.ctshk.rpc.order.scenic.service.impl.app;

import com.ctshk.common.dto.Result;
import com.ctshk.rpc.order.scenic.entity.app.ScenicOrderReceipt;
import com.ctshk.rpc.order.scenic.mapper.app.ScenicOrderReceiptAppMapper;
import com.ctshk.rpc.order.scenic.req.app.ScenicOrderReceiptReq;
import com.ctshk.rpc.order.scenic.service.app.IScenicOrderReceiptAppService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@DubboService
public class ScenicOrderReceiptAppServiceImpl implements IScenicOrderReceiptAppService {
    @Autowired
    ScenicOrderReceiptAppMapper scenicOrderReceiptAppMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Result<Boolean> insertScenicOrderReceipt(ScenicOrderReceiptReq scenicOrderReceiptReq) {
        ScenicOrderReceipt scenicOrderReceipt = new ScenicOrderReceipt();
        BeanUtils.copyProperties(scenicOrderReceiptReq, scenicOrderReceipt);
        scenicOrderReceiptAppMapper.insert(scenicOrderReceipt);
        return Result.success(true);
    }
}
